package com.era.act.news;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.era.entity.NewsInfo;
import com.era.srv.NewsService;

public class NewsInsert extends ActionSupport implements ModelDriven<NewsInfo>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public NewsInfo getNewsInfo() {
		return newsInfo;
	}
	public void setNewsInfo(NewsInfo newsInfo) {
		this.newsInfo = newsInfo;
	}
	public NewsService getNewsSer() {
		return newsSer;
	}
	public void setNewsSer(NewsService newsSer) {
		this.newsSer = newsSer;
	}
	private NewsInfo newsInfo = new NewsInfo();
	private NewsService newsSer;
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		System.out.println(newsInfo.getTitle());
		if(newsInfo.getTitle() != null && !"".equals(newsInfo.getTitle())){
		newsSer.save(newsInfo);
		return SUCCESS;
		}
		return ERROR;
	}
	public NewsInfo getModel() {
		// TODO Auto-generated method stub
		return newsInfo;
	}



}
